function logout() {

    $.ajax({
        url:"/api/v1.0/session/logout",
        type:'delete',
        success:function (data) {
          if (0 == data.errno) {
            location.href = "/";
        } else {
              alert("请重试")
          }
        }

    });


    // $.ajax("/api/v1.0/session/logout", function(data){
    //     if (0 == data.errno) {
    //         location.href = "/";
    //     }
    // })
}

$(document).ready(function(){
    $.get('/api/v1.0/user_profile',function (resp) {
        if(resp.errno == 0){
            //返回信息成功
            $('#user-name').text(resp.data.user_name);
            $('#user-mobile').text(resp.data.user_mobile);
            $('#user-avatar').attr("src",resp.data.avatar_url);

        }else {
            location.href = '/index.html'
        }
    })

})